<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	template="template.xhtml">
	
	<ui:define name="header">
		<style type="text/css">
			.yui-dt {
				margin-top:10px;
			}
			
			.yui-dt table {
				width:100%;
			}
			
			.yui-ac {
				width:200px;
				padding-bottom:1em; 
			}
			
			.label {
				width:20%;
				padding:4px;
			}

			.value {
				width:80%;
				padding:4px;
			}
			
			.grid {
				width:100%;
			}
		</style>
	</ui:define>

	<ui:define name="content">
	
		<h:form >
			<p:panel header="Search Etairs">
				<h:panelGrid columns="3">
					
					 <h:outputText value="country Code:"/>
					 <h:inputText id="countryCode" value="#{manageEtairports.countryCode}"/>
					<p:commandButton value="Search" actionListener="#{manageEtairports.search}"  update="tableform"/>
					<!--  async="true" update="etairports"-->
				</h:panelGrid>
			</p:panel>
		</h:form>
		<h:form id="tableform" >
		 <h:inputHidden id="hidden_countryCode" value="#{manageEtairports.countryCode}"></h:inputHidden>
			<p:dataTable id="etairports" rendered="#{manageEtairports.renderTbl}" 
			var="etairport" value="#{manageEtairports.dataModel}" rows="10" 
			 paginator="true" lazy="true"  > <!--  selection="#{manageEtairports.etAirport}" selectionMode="single" update="tableform,detailsTable" onselectComplete="detailsDialog.show();" -->
			
				<p:column>
					<f:facet name="header">
						<h:outputText value="Chinese Name" />
					</f:facet>
					<h:outputText value="#{etairport.airportChBrief}"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="English Name" />
					</f:facet>
					<h:outputText value="#{etairport.airportEnBrief}"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="code" />
					</f:facet>
					<h:outputText value="#{etairport.airportCode}"></h:outputText>
				</p:column>
				
				<p:column>
					<f:facet name="header">
						<h:outputText value="Options" />
					</f:facet>
				
					<p:commandLink   value="View"  actionListener="#{manageEtairports.showView}" process="tableform" ajax="true" update="frm_dlg"  onerror="alert('this')"  oncomplete="detailsDialog.show()">
						<f:param name="aircode" value="#{etairport.airportCode}"></f:param>
					</p:commandLink>
					
					
				</p:column>
				
			</p:dataTable>
			<!-- 
					<h outputLink value="createEtairport.html">
						<f param name="airportCode" value=" {etairport.airportCode}"></f param>
						edit item
					</h outputLink>
			 -->
		
			
		<p:commandLink   value="View AAT"   actionListener="#{manageEtairports.showView}" ajax="true" update="frm_dlg"  onerror="alert('this')" oncomplete="detailsDialog.show()">
						<f:param name="aircode" value="AAT"></f:param>
		</p:commandLink>
		</h:form>
		
	
		<h:form id="frm_dlg">
			<p:dialog id="detailsDialog" header="Etairport Details" widgetVar="detailsDialog"  draggable="true"  fixedCenter="true">
			
				<h:inputHidden value="#{manageEtairports.editEtairport.airportCode}" />
			<h:panelGrid id="detailsTable" columns="2" width="300px" >
				<h:outputText value="Chinese Name" />
				<h:inputText value="#{manageEtairports.editEtairport.airportChBrief}" />
				<h:outputText value="English Name" />
				<h:inputText value="#{manageEtairports.editEtairport.airportEnBrief}" />
				<h:outputText value="country code"/>
				<h:inputText value="#{manageEtairports.editEtairport.barcode}"></h:inputText>
				<h:outputText value="Air Port" />
				<h:outputText value="#{manageEtairports.editEtairport.airportCode}" />
				<h:outputText value="City Code" />
				<h:inputText value="#{manageEtairports.editEtairport.cityCode}" />
				<p:commandButton value="save" actionListener="#{manageEtairports.saveEtairport}"  ajax="true" update="tableform"></p:commandButton>
			</h:panelGrid>
			
		</p:dialog>
		</h:form>
		
		<!-- <h form>
			<p fileUpload fileUploadListener="{manageEtairports.handleUpLoad}"    
    allowTypes="*.xls" description="excel"/> 
		</h form>
		-->
	</ui:define>

</ui:composition>